package com.example.wms_supermarket.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.BufferedReader;
import java.io.Reader;
//开发中测试方法的controller，可以无视
@RestController
public class HellowWorldController {
    @PostMapping("/truckMessage")
    public void message(HttpServletRequest httpServletRequest) throws Exception{
        BufferedReader reader = httpServletRequest.getReader();
        StringBuilder requestBody = new StringBuilder();
        String line = "";
        while (true) {
            if (!((line = reader.readLine()) != null)) break;
            requestBody.append(line);
        }
        String requestBodyString = requestBody.toString();
        System.out.println(requestBodyString);
    }
}
